Skip to content

fix(assets-controller): consume account activity#9517

Open
Kriys94 wants to merge 4 commits into
mainfrom
fix/AssetsAccountActivity
Open

fix(assets-controller): consume account activity#9517
Kriys94 wants to merge 4 commits into
mainfrom
fix/AssetsAccountActivity

Conversation

@Kriys94

@Kriys94 Kriys94 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

High Risk
Breaking removal of BackendWebsocketDataSource and a new top-priority real-time balance path affect core asset tracking and chain assignment; integration mistakes (messenger/events or AccountActivityService ownership) could cause missing balances or duplicate polling.

Overview
BREAKING: Removes BackendWebsocketDataSource and all BackendWebSocketService messenger wiring from AssetsController. Real-time balances and per-chain up/down status now flow only through AccountActivityDataSource, which listens to AccountActivityService:balanceUpdated and AccountActivityService:statusChanged and pushes updates via an injected onAssetsUpdate callback (no separate controller subscription).

AccountActivityDataSource is the first balance source in the chain-claiming order: chains reported up on statusChanged are reserved for WebSocket-driven updates so AccountsApiDataSource / RpcDataSource do not poll them. Custom-asset graduation and docs/tests are updated to name AccountActivityDataSource instead of the websocket data source.

When data sources report active-chain changes, AssetsController now #scheduleSubscribeAssets instead of calling #subscribeAssets immediately: 250ms debounce plus up to 5s jitter, with the earliest scheduled run winning when multiple updates overlap. #stop clears the pending timer; when the timer fires it re-checks UI open, keyring unlocked, and isEnabled() so a re-subscribe cannot restart polling after tracking was torn down.

Network-switch refresh no longer calls websocket data-source refreshActiveChains (only Accounts API + RPC).

Reviewed by Cursor Bugbot for commit 57ead5d. Bugbot is set up for automated code reviews on this repo. Configure here.

@Kriys94
Kriys94 force-pushed the fix/AssetsAccountActivity branch 4 times, most recently from 3ddda90 to d937cef Compare July 20, 2026 08:07
@Kriys94
Kriys94 force-pushed the fix/AssetsAccountActivity branch from 90dafcd to 150e8b9 Compare July 22, 2026 14:15
@Kriys94
Kriys94 marked this pull request as ready for review July 22, 2026 14:15
@Kriys94
Kriys94 requested review from a team as code owners July 22, 2026 14:15
@Kriys94
Kriys94 temporarily deployed to default-branch July 22, 2026 14:16 — with GitHub Actions Inactive
Comment thread packages/assets-controller/src/AssetsController.ts
Comment thread packages/assets-controller/src/AssetsController.ts
@Kriys94
Kriys94 force-pushed the fix/AssetsAccountActivity branch 2 times, most recently from f9b8d3c to a44a1c0 Compare July 22, 2026 15:25

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a44a1c0. Configure here.

Comment thread packages/assets-controller/src/AssetsController.ts
@Kriys94
Kriys94 force-pushed the fix/AssetsAccountActivity branch from a44a1c0 to d1c1b1e Compare July 22, 2026 15:44
@Kriys94
Kriys94 force-pushed the fix/AssetsAccountActivity branch from 0db2a63 to 57ead5d Compare July 24, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant